package com.jounghu.gambling;

import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RestController;

import java.util.Properties;

/**
 * @author hujiansong
 */
@SpringBootApplication
@Slf4j
@RestController
public class GamblingApplication implements CommandLineRunner {



    public static void main(String[] args) {
        SpringApplication.run(GamblingApplication.class, args);
    }

    @Override
    public void run(String... strings) {
        log.info("Application Start RUNNING....");
    }


    @Bean
    public PageHelper pageHelper() {
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum", "true");
        properties.setProperty("rowBoundsWithCount", "true");
        properties.setProperty("reasonable", "true");
        // 配置mysql数据库的方言
        properties.setProperty("dialect", "mysql");
        pageHelper.setProperties(properties);
        return pageHelper;
    }



}
